# encoding:utf-8
#! /usr/bin/python
# filename: constants.py
'''
该类定义常量
'''
from source.confs.EnvVars import EnvVars


class Config:
    # server:10.216.2.38 Region:RegionOne Project:NFV4HW
    OpenStack_URL = EnvVars.OPENSTACK_SERVER_PM
    OpenStack_User = EnvVars.OPENSTACK_USERNAME_PM
    OpenStack_Password = EnvVars.OPENSTACK_PASSWORD_PM
    OpenStack_Project = EnvVars.OPENSTACK_PROJECT_PM
    IdentityService_Port = EnvVars.IDENTITYSERVICE_PORT_PM
    ComputeService_Port = EnvVars.COMPUTESERVICE_PORT_PM
    MonitoringService_Port = EnvVars.MONITORINGSERVICE_PORT_PM
    REGION_ID = EnvVars.REGION_ID


    GetToken_Rest_URL = '/v3/auth/tokens'
    ValidateToken_Rest_URL = '/v3/auth/tokens'
    SetAlarm_Rest_URL = '/v2/alarms'
    GetResources_Rest_URL = '/v2/resources'
    GetMeters_Rest_URL = '/v2/meters'
    GetServers_Rest_URL = '/servers/detail'
    GetFlavors_Rest_URL = '/flavors'
    GetServers_S_Rest_URL = '/servers'
    GetInterface_Rest_URL = '/os-interface'
    GetVolume_Rest_URL = '/os-volume_attachments'

    OpenO_URL = EnvVars.OPENO_SERVER
    OpenO_Port = EnvVars.OPENO_PORT

    InsertAlarm_Rest_URL = '/api/umc/v1/fm/curalarms/insert'
    GetMonitorinfo_Rest_URL ='/api/umc/v1/monitor_parallel/monitorinfo'
    SetMonitorinfo_Rest_URL = '/api/umc/v1/monitor_parallel/monitorinfo'
    GetCurAlarms_Rest_URL = '/api/umc/v1/fm/curalarms/count'
    Request_Timeout = 120

    METER_RESOURCE_ID = 'resource_id'
    METER_NAME_CPU = 'cpu_util'
    METER_NAME_MEM = 'memory.usage'
    METER_NAME_DISK_READ = 'disk.device.read.bytes.rate'
    METER_NAME_DISK_WRITE = 'disk.device.write.bytes.rate'
    METER_NAME_NETWORK_INCOMING = 'network.incoming.bytes.rate'
    METER_NAME_NETWORK_OUTGOING = 'network.outgoing.bytes.rate'
    METER_ALARM_NUMS = 'alarm_nums'
    METER_TIMESTAMP = 'timestamp'

    OPENSTACK_SERVICE_NOVA = 'nova'
    OPENSTACK_SERVICE_CEILOMETER  = 'ceilometer'
    OPENSTACK_SERVICE_TOKEN = 'token'


    AUTH_DATA = {
        "auth": {
            "identity": {
                "methods": ["password"],
                "password": {
                    "user": {
                        "name": "null",
                        "password": "null"
                    }
                }
            },
            "scope": {
                "project": {
                    "name": "null",
                    "domain": {
                        "name": "null"
                    }
                }
            }
        }
    }
    AUTH_DATA["auth"]["identity"]["password"]["user"]["name"] = EnvVars.OPENSTACK_USERNAME_PM
    AUTH_DATA["auth"]["identity"]["password"]["user"]["password"] = EnvVars.OPENSTACK_PASSWORD_PM
    AUTH_DATA["auth"]["scope"]["project"]["name"] = EnvVars.OPENSTACK_PROJECT_PM
    AUTH_DATA["auth"]["scope"]["project"]["domain"]["name"] = EnvVars.OPENSTACK_DOMAIN






